#include <iostream>
#include <string>
#include <stack>
using namespace std;
const int N = 110;
char a[N];
string tmp;
string sc;
stack<char> s;
stack<int> num;
int a,b;
char caozuo;
bool isnum(char x)
{
    if(x > '0' && x < '9') return true;
    return false;
}

bool isoperator(char x)
{
	if(x== '/' || x=='*' || x=='+' || x=='-') return true;
	else return false;
}

int main()
{
    string a;
    cin>>a;
    for(int i = 0;i < a.size() ;i ++ )
    {
        if(a[i]=='(') s.push(a[i]-'0');
        else if(isnum(a[i]))
        {
            while(isnum(a[i])) tmp += a[i];
            int t = stoi(tmp,0,10);
            num.push(t);
        }
        else if(a[i]==')')
        {
        	b = num.pop();
        	caozuo = s.pop();
        	if(!s.empty())
			{
				a = s.pop();
        		s.pop();
        		printf("%d%c%d",a,caozuo,b);
			}
			else
			{
				printf("%c%d",caozuo,b);
			}
		}
		else if(isnum(a[i]))
		{
			while(isnum(a[i])) tmp += a[i];
            int t = stoi(tmp,0,10);
            num.push(t);
		}
		else if(isoperator(a[i]))
		{
			if(s.top()=='(' || s.empty()) s.push(a[i]);
			
		}
    }
    return 0;
}
